home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 13 / 013.d81 / think again (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  7KB  |  177 lines

  1. 0 gosub61000
  2. 1 poke250,0
  3. 4  rem in checking black peg may need to   times 2nd # by two
  4. 5  wd$="qwerty":tg=1:bk$="[157][157][157][157][157][157][157][157]"
  5. 6  forcs=54272to54296:pokecs,0:next
  6. 10  poke53281,0:print"[147]":dimc$(15)
  7. 20  fori=1to15:readc$(i):next
  8. 22  ifpeek(250)=1then30
  9. 25 input"[147][201]nstructions  y[157][157][157]";a$:ifleft$(a$,1)="y"thenpoke250,1:goto8000
  10. 30 input"[147][206]umber of colors to choose from";nc:ifnc>15ornc<2then30
  11. 31 input"[206]umber of digits in code";nd:ifnd>7ornd<2then31
  12. 32 input"[206]umber of guesses";ng:ifng>20orng<2then32
  13. 33 print"[147]":gosub5600:fort=1tond:rem code here
  14. 34  a=int(14*rnd(.))+1:ifa>ncthen34
  15. 35  cd$(t)=mid$(c$(a),2,1)+mid$(c$(a),3,1):na$=na$+mid$(c$(a),1,1):next
  16. 40  gosub2020:rem print options
  17. 50  gosub900:rem your guess
  18. 55  geta$:ifa$=""then55
  19. 60  ifval(a$)=0orval(a$)>9then3000
  20. 70  yg=val(a$):ifyg>ncthen55
  21. 75  ag=ag+1
  22. 80  ifyg>ncthenag=ag-1:goto55
  23. 90  gs$(ag)=mid$(c$(yg),2,1)+mid$(c$(yg),3,1)
  24. 200  rem print number guessed
  25. 210  gosub600:ifag=ndthen230
  26. 220  goto55
  27. 230  geta$:ifa$=""then230
  28. 240  ifa$="_"then3000
  29. 250  tg=tg+1
  30. 299  rem black pegs
  31. 300  fork=1tond:af$(k)=cd$(k):next:forir=1tond:ifaf$(ir)="-"then310
  32. 305  ifaf$(ir)=gs$(ir)thenbl=bl+1:gs$(ir)="-":af$(ir)="-":gosub4500
  33. 310  next
  34. 320  ifbl=ndthengoto5000
  35. 329  rem white pegs
  36. 330  forie=1tond:forot=1tond:ifaf$(ie)="-"then350
  37. 340  ifaf$(ie)=gs$(ot)thenwh=wh+1:gs$(ot)="-":af$(ie)="-":gosub4600
  38. 350  nextot,ie
  39. 400  rem print out pegs
  40. 410  printtab(20)"[151]";bl;spc(4)"";wh;spc(4)""wh+bl:iftg=ng+1then6000
  41. 420  fort=1tond:gs$(t)="":next:ag=0:bl=0:wh=0:goto50
  42. 600  printmid$(c$(yg),2,1)mid$(c$(yg),3,1)spc(7)""mid$(c$(yg),1,1);bk$;
  43. 610  poke54296,15:poke54277,0:poke54278,247:poke54276,17:poke54273,yg*10:poke54272,0
  44. 620  forg=1to100:next:poke54276,16:return
  45. 900  printtg;:iftg<10thenprintspc(2);:return
  46. 910  printspc(1);:return
  47. 2000  data"1[209]","2[209]","3[159][209]","4[156][209]","5[209]","6[209]","7[158][209]","8[129][209]","9[149][209]","q[150][209]","w[151][209]"
  48. 2010  data"e[152][209]","r[153][209]","t[154][209]","y[155][209]"
  49. 2020  print"";:fori=1tonc:print""mid$(c$(i),1,1);:next:print"[146]"
  50. 2030  fori=1tonc:printmid$(c$(i),2,1);mid$(c$(i),3,1);:next:print"_":return
  51. 3000  rem check guess for validity
  52. 3005  ifa$="_"andag>0thenag=ag-1:g$=left$(g$,ag):print"[157] [157]"spc(8)" [157][157][157][157][157][157][157][157][157]";:goto4000
  53. 3006  ifa$="_"andag=0then55
  54. 3007  ifa$="c"thena$=mid$(na$,ag+1,1):fort=1to75:poke53280,t:next:goto60
  55. 3008  ifa$="s"then6010
  56. 3010  foriu=1to6:ifmid$(wd$,iu,1)=a$thenyg=iu+9:ag=ag+1:goto80
  57. 3020  next:goto55
  58. 3050  stop
  59. 4000  poke54296,15:poke54277,0:poke54278,247:poke54276,33:poke54273,20:poke54272,.
  60. 4010  forg=1to100:next:poke54276,32:goto55
  61. 4500  poke54296,15:poke54277,0:poke54278,247:poke54276,129:poke54273,255:poke54272,0
  62. 4510  forg=1to100:next:poke54276,128:return
  63. 4600  poke54296,15:poke54277,0:poke54278,247:poke54276,129:poke54273,20:poke54272,.
  64. 4610  forg=1to100:next:poke54276,128:return
  65. 5000  gosub7000:print:print"you got it in"tg-1"guesses"
  66. 5010 input"play again?";yn$:ifyn$="y"oryn$="yes"thenrun4
  67. 5020  ifyn$<>"n"andyn$<>"no"then5010
  68. 5030  goto63000: rem  end
  69. 5600 print:printchr$(142)" #  guess   guess   [151]black  white  [152]total":return
  70. 6000  gosub7500:print:print:print"you ran out of guesses!!![145][145][145]"
  71. 6010  print:print"code ";:fori=1tond:printcd$(i)""spc(7)mid$(na$,i,1);bk$;:next
  72. 6020  print""
  73. 6030  goto5010
  74. 6040  :
  75. 6050  end
  76. 7000  poke54296,15:poke54277,190:poke54278,248:poke54276,17:poke54272,0
  77. 7010  fork=1to100:poke54276,17:poke54273,k
  78. 7020  poke54276,16:next:return
  79. 7500  poke54296,15:poke54277,190:poke54278,248:poke54276,17:poke54272,0
  80. 7510  forjk=1to2:poke54276,jk*5:fork=1to20:poke54276,17:poke54273,k
  81. 7520  next
  82. 7530  fork=20to1step-1:poke54276,17:poke54273,k
  83. 7540  poke54276,16:next:next:return
  84. 8000 printchr$(142)"[147]  this is a game in which the computer"
  85. 8005 print"randomly selects a secret code that you"
  86. 8010 print"are to guess.  its code consists of"
  87. 8020 print"colored pegs.  naturally, the more"
  88. 8030  print"different colored pegs it has to choose"
  89. 8040 print"from, the more difficult it is to guess"
  90. 8050 print"which colors it has chosen.  you are"
  91. 8060  print"allowed to specify how many of the 15"
  92. 8070  print"possible colors the computer will use.":gosub60000
  93. 8080 print"[147]you are also allowed to specify how many"
  94. 8090 print"pegs will be used in the code.  if four"
  95. 8100 print"is selected, the computer will choose"
  96. 8110  print"4 colored pegs to be it's secret code."
  97. 8120 print"the maximum length of the code is seven"
  98. 8130 print"digits long.  the secret code would look";
  99. 8140  print"something like this-[156][209][209][209][209][151][209][209] if 6"
  100. 8150  print"was selected for code length.":gosub60000
  101. 8160 print"[147] one other option permits you to "
  102. 8170  print"enter and that is how many guesses you"
  103. 8180 print"are allowed before you lose.  20 is the"
  104. 8190 print"maximum number of guesses you may have"
  105. 8200 print"before the computer tells you its code."
  106. 8210 :
  107. 8220 print"you make your guesses by entering"
  108. 8230 print"numbers or letters.  when you enter a"
  109. 8240 print"character, the character and its"
  110. 8250 print"corresponding color will appear next to"
  111. 8260  print"the number of the guess you are on.":gosub60000
  112. 8270 print"[147]the following table shows what color"
  113. 8280 print"will appear for each key."
  114. 8290 fori=1to15:print""left$(c$(i),1)"  ";right$(c$(i),2):next
  115. 8291 print"a similar table is shown at the top of"
  116. 8292 print"the playing screen during the game."
  117. 8300  gosub60000:
  118. 8310 print"[147]if you enter a wrong character, simply"
  119. 8320  print"press the _ key and the previous"
  120. 8330 print"character is removed.  if you wish to"
  121. 8340 print"cheat, press the c key and the correct"
  122. 8350  print"peg will appear in the spot you are at.":gosub60000
  123. 8360 print"[147]be sure to turn the volume up for each"
  124. 8370 print"character has its own sound.  after you"
  125. 8380  print"have typed in the right number of"
  126. 8390  print"characters and you are satisfied with"
  127. 8400 print"your entry, press any key and your"
  128. 8410  print"rating will show up.":gosub60000
  129. 8412 print"[147] if a number shows up under the column"
  130. 8420 print"headed black, it means you have that"
  131. 8430 print"number of pegs that are the right color"
  132. 8440 print"and in the right position."
  133. 8450 print" if a number shows up under the column"
  134. 8460  print"headed white, it means you have that"
  135. 8470  print"number of pegs that are the right color,"
  136. 8480  print"but in the wrong position."
  137. 8490 print"the last column indicates the total"
  138. 8500  print"number of white and black pegs."
  139. 8505  gosub60000
  140. 8510 print"[147]  note:  black pegs are not included in"
  141. 8520 print"the number of white pegs.  for example-"
  142. 8530 print"if you have a red peg in the right"
  143. 8540  print"place you will not get a white peg for"
  144. 8550 print"having a right color.  a white peg is"
  145. 8560 print"given for a peg of the right color but"
  146. 8570  print"in the wrong place."
  147. 8580 print"if you use up all your guesses the"
  148. 8590  print"secret code is revealed.":gosub60000
  149. 8600 print"[147]beware: many surprises await you in this";
  150. 8610 print"game.  try selecting a code of 7 pegs"
  151. 8620 print"long and 15 different colors (and dont"
  152. 8630  print"use the cheat key)!!"
  153. 8640 print" 1. let's play!":print" 2. let's read the instructions again."
  154. 8642 print" 3. let's go back to loadstar."
  155. 8650 print"which ?"
  156. 8651 poke198,0:wait198,1:getz$:
  157. 8652 ifval(z$)<1orval(a$)>3thenpoke53280,rnd(1)*10:goto8651
  158. 8653 on val(z$)goto30,8000,63000
  159. 8660  goto8000
  160. 60000  print""spc(12)"<press a key>";
  161. 60002  poke198,0:wait198,1:geta$:return
  162. 61000 t$="                         ":c=0:c$="":print"[147]":poke53281,0
  163. 61030 printspc(7)""t$:printspc(7)"       [212]hink [193]gain       [146]"
  164. 61051 printspc(7)""t$:print:printtab(18)"by"
  165. 61060 print:printspc(14)"[210]on [195]offen"
  166. 61070 print:printspc(12)"[195]opyright 1985"
  167. 61080 print:print:print:print"     [204][207][193][196][211][212][193][210] is not public domain."
  168. 61090 print:print"  [208]lease respect the author's rights."
  169. 61100 p